home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / source / snip9503 / scrnmacs.h < prev    next >
C/C++ Source or Header  |  1995-03-14  |  3KB  |  107 lines

  1. /*
  2. **  Macros for managing direct video writes by Jerry Houston
  3. **
  4. **  prototypes for SCROLL.C and VIDPORT.C functions added by Bob Stout
  5. */
  6.  
  7. #if defined(__TURBOC__)
  8.  #define FAR far
  9. #else
  10.  #define FAR _far
  11. #endif
  12.  
  13. #undef MK_FP
  14. #define MK_FP(seg,off) ((void far *)(((long)(seg) << 16)|(unsigned)(off)))
  15.  
  16. /*
  17. **  Text screen scrolling function from SCROLL.C in SNIPPETS
  18. */
  19.  
  20. #define SCROLL_UP 0
  21. #define SCROLL_DN 1
  22.  
  23. void scroll(int direction,
  24.             int num_lines,
  25.             int vattrib,
  26.             int ulrow,
  27.             int ulcomumn,
  28.             int lrrow,
  29.             int lrcolumn);
  30.  
  31. /*
  32. **  Structure to save/restore screen
  33. */
  34.     
  35. struct SCREEN {
  36.       unsigned short *vbuf;
  37.       int             curX,
  38.                       curY;
  39. };
  40.  
  41. /*
  42. **  Functions in VIDPORT.C in SNIPPETS
  43. */
  44.  
  45. void GotoXY(int col, int row);
  46. void ClrScrn(int vattrib);
  47. void GetCurPos(int *col, int *row);
  48. int  GetCurAtr(void);
  49. void ClrEol(void);
  50. void ClrEop(void);
  51. void Repaint(int vattrib);
  52. struct SCREEN *SaveScrn(void);
  53. void RestoreScrn(struct SCREEN *screen);
  54. void FreeScrnBuf(struct SCREEN *screen);
  55.  
  56. #if !defined(COLORMODE)
  57.  #define COLORMODE  ((*(char FAR *)0x0449L) != 7)
  58.  #define EXT_KBD    (*(char FAR *)0x0496L & 16)
  59.  #define VIDPAGE    (*((unsigned char far *)0x0462L))
  60.  #define ROWSIZE    (*(int FAR *)0x044AL)
  61.  #define SCANLINES  ((int)*(char FAR*)0x0461L)
  62.  #define SCRBUFF    ((unsigned FAR *)((COLORMODE)?0xB8000000L:0xB0000000L))
  63.  #define SCREENSEG  ((unsigned)((COLORMODE)?0xB800:0xB000))
  64.  #define SCRNBYTES  (*(int FAR *)0x44CL)
  65.  #define SCRNPIXELS (SCRNBYTES >> 1)
  66.  #define SCREENCOLS (*(int FAR *)0x044AL)
  67.  #define SCREENROWS ((*(char FAR *)0x0484L) ? 1 + (*(char FAR *)0x0484L): 25)
  68. #endif
  69.  
  70. /*
  71.      COLORMODE  = true/false, are we using color?
  72.      EXT_KBD    = true/false, extended keyboard in use?
  73.      VIDPAGE    = current video page in use
  74.      SCANLINES  = number of scan lines in a character.
  75.      SCRBUFF    = returns B800:0000 if using color, B000:0000 if mono.
  76.      SCREENSEG  = when you just need the segment portion.
  77.      SCRNBYTES  = number of bytes required to save screen.
  78.      SCRNPIXELS = number of (2-byte) pixels required to save screen.
  79.      SCREENCOLS = number of columns, often 80.
  80.      SCREENROWS = number of rows, usually defaults to 25.
  81. */
  82.  
  83. /*
  84. ** colors -- Use as is for foreground colors
  85. **           For background, shift left by 4 and OR with
  86. **           foreground and possible video attributes
  87. */
  88.  
  89. #define BLACK 0
  90. #define BLUE 1
  91. #define GREEN 2
  92. #define CYAN 3
  93. #define RED 4
  94. #define MAGENTA 5
  95. #define BROWN 6
  96. #define WHITE 7
  97. #define GRAY 8
  98. #define LTBLUE 9
  99. #define LTGREEN 10
  100. #define LTCYAN 11
  101. #define LTRED 12
  102. #define LTMAGENTA 13
  103. #define YELLOW 14
  104. #define HIWHITE 15    /* hi-intensity white */
  105.  
  106. #define BG_(a) (((a) & 0x7f) << 4)
  107.